package AI.screens
{
	import com.cheezeworld.AI.AISettings;
	import com.cheezeworld.AI.Behaviors.*;
	import com.cheezeworld.entity.*;
	import com.cheezeworld.math.MathUtils;
	import com.cheezeworld.screens.IScreenItem;
	import com.cheezeworld.screens.Root;
	import com.cheezeworld.utils.Input;

	public class GroupBehaviorDemo extends AIDemoScreen
	{
		public function GroupBehaviorDemo(a_parentScreen:IScreenItem=null)
		{
			super(a_parentScreen);
			
			screenLabel = "Flocking \n Seperation + Alignment + Cohesion";
			
			// Create some boids
			
			var bigBoid:Boid = _factory.getEntity( "Boid1", _gameworld ) as Boid;
			bigBoid.steering.addBehavior( new Arrive( Input.instance.worldMousePos, AISettings.arriveFast ));
			bigBoid.maxSpeed = 100;
			bigBoid.maxTurnRate = bigBoid.maxTurnRate * 0.5;
			
			var boid:Boid;
			for( var i:int = 0; i < 40; i++ )
			{
				boid = _factory.getEntity( "Boid1", _gameworld ) as Boid;
				boid.newPos.Set( MathUtils.rand( 0, Root.WIDTH ), MathUtils.rand( 0, Root.HEIGHT ));
				boid.steering.addBehavior( new Alignment() );
				boid.steering.addBehavior( new Cohesion() );
				boid.steering.addBehavior( new Seperation() );
				boid.steering.addBehavior( new Evade( bigBoid, 100*100 ));
				boid.scale = .5;
			}
			
		}	
		
	}
}